import java.awt.Point;
import java.util.ArrayList;

public class Machine extends Agent {

	private static long lastId;

	public Machine(Point p) {

		super(p);
		lastId++;
		setId(lastId);
	}



	@Override
	public MapObjectType getType() {
		return MapObjectType.Machine;
	}

	@Override
	public void makeMove() {
		Action a = getProvider().decide();
		if (a.getEvokerType() == MapObjectType.Machine) {
			switch (a.getName()) {
			case "move":
				if (a.getDirection() != null) {
					this.move(a.getDirection());
				} else {
					System.err.println("Move action requires direction");
				}
				break;
			case "replenish":

				this.replenish();

				break;
			case "attack":
			{
				this.fight(a.getEvokerId()); //?
			}
				break;
			default:
				break;
			}
		} else if(a.getEvokerType()==MapObjectType.NO_OBJECT){
			// TODO
		} else {
			
		}


		
	}
	

	public boolean isEnemy(MapObject wo) {
		Agent agent = (Agent) wo;
		if(agent.getType() != MapObjectType.Machine)
			return true;
		else
			return false;
	}
	
}
